Adding a char inside path string
Hitesh
hitesh287 at gmail.com
Wed Aug 16 12:00:57 EDT 2006
Thank you Fredrik. 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?
ty
hj
Fredrik Lundh wrote:
> "Hitesh" wrote:
>
> > I get path strings from a DB like:
> >
> > \\serverName\C:\FolderName1\FolderName2\example.exe
> >
> > I am writing a script that can give me access to that exe file.
> > But problem is that string is not universal path, I need to add C$.
> > Any idea how I can add $ char in that string.
> > ServerName is not fixed length. It could be any chars length.
>
> upath = path.replace("C:", "C$")
>
> </F>
More information about the Python-list
mailing list