If your problem is about reading from and into files...
FileObj = open(Filename,m ode) eg:f = open("tmp.txt", "w")
read and readlines can be used to read data from file
eg: FileData = f.read() reads all the data of file into FileData
write and writelines can be used to write
coming to your string manipulations
someString = 'A string'
...
User Profile
Collapse
-
I could not exactly understand your problem.
According to my understanding you dont want the whole Filepath to be printed on the console.
Try this code
Code:Curdir = os.getcwd() for DirInfo in os.walk(Curdir): for File in DirInfo[2]: print (DirInfo[0]+"\\"+File).replace(Curdir,"")
Leave a comment:
-
if all you want is to make another xml ( still a text file ) dont bother that it is xml and u can use just file operations to make the xml file.
Code:TxtFileData = [aLine.strip() for aLine in open('data.txt').readlines()] while "" in TxtFileData: TxtFileData.remove("") ## To remove any line in between if there is no data XmlData = """ <people>
Leave a comment:
No activity results to display
Show More
Leave a comment: