Adding a char inside path string
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Wed Aug 16 12:28:30 EDT 2006
In <1155744057.573884.111850 at m73g2000cwd.googlegroups.com>, Hitesh wrote:
> That works for a string.
> But I am getting list of tuples from DB.
>
> rows = [('\\serverName\C:\FolderName1\FolderName2\example.exe',),
> ('\\serverName\C:\FolderName1\FolderName2\example2.exe',),
> ('\\serverName\C:\FolderName1\FolderName2\example3.exe',),
> ('\\serverName\C:\FolderName1\FolderName2\example4.exe',)]
>
> I tried this:
> for i in rows:
> row = str(i)
> path = row.replace("C:" , "c$")
> print path
>
> I am getting path something like
>
> ('\\serverName\c$:\FolderName1\FolderName2\example.exe',)
>
> How on the earth I can remove those paranthesis?
Well, don't convert the tuple to a string but get the string out of the
tuple instead.
for row in rows:
path = row[0].replace('C:', 'C$')
print path
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list