更新时间:2022-11-22 13:16:45
You need escape ?
by \
:
You need escape ?
by \
:
df['URL'] = df['URL'].str.replace('\?v=', 'ppp')
print (df)
Id Title URL
0 Id-1 Bruce Almighty https://www.***.com/watchppp5VGyTOGxyVA
1 Id-2 Superhero Movie https://www.***.com/watchppp3BnXz-7-y-o
2 Id-3 Taken https://www.***.com/watchpppvjbfiOERDYs
3 Id-4 Forest Gump https://www.***.com/watchpppeJFkCJySHdY&t=...
df['URL'] = df['URL'].replace('\?v=', 'ppp', regex=True)
print (df)
Id Title URL
0 Id-1 Bruce Almighty https://www.***.com/watchppp5VGyTOGxyVA
1 Id-2 Superhero Movie https://www.***.com/watchppp3BnXz-7-y-o
2 Id-3 Taken https://www.***.com/watchpppvjbfiOERDYs
3 Id-4 Forest Gump https://www.***.com/watchpppeJFkCJySHdY&t=...