stergema's Profile
Reputation: 0
Apprentice
- Group:
- New Members
- Active Posts:
- 3 (0 per day)
- Joined:
- 02-March 08
- Profile Views:
- 79
- Last Active:
Oct 09 2012 04:47 AM- Currently:
- Offline
Previous Fields
- Dream Kudos:
- 0
Latest Visitors
Posts I've Made
-
In Topic: xlwt
Posted 2 Oct 2012
No one? Here's a simpler aproach:
import os import xlwt import os.path from win32com.client import Dispatch #link = raw_input("Linkul: ") for dirname, dirnames, filenames in os.walk(r"C:/Users/s/Desktop/filme/"): for subdirname in dirnames: foldere_filme = os.path.join(dirname, subdirname) numarul_folderelor = foldere_filme.replace("C:/Users/s/Desktop/filme/", "") print numarul_folderelor #1,2,3,4,5... for filenames in os.listdir(foldere_filme): numele_pt_text = filenames.replace(".avi", "") print numele_pt_text root_text = "C:/Users/s/Desktop/text/"+numarul_folderelor+".txt" fisier_text = open(""+root_text+"", "w") fisier_text.writelines( "Full Movie: \n\n\nwatch " +numele_pt_text+" online free, watch " +numele_pt_text+" online") fisier_text.close()
It only saves in the text files: root_text = "C:/Users/s/Desktop/text/"+numarul_folderelor+".txt" the last filename from the list in within the subfolders, i want to save all of them. -
In Topic: xlwt
Posted 2 Oct 2012
JackOfAllTrades, on 02 October 2012 - 03:39 AM, said:Where's your indentation? It's a little hard to find problems in Python code withoutthe correctany indentation.
import os import xlwt from xlwt import * import os.path #link = raw_input("Linkul: ") for dirname, dirnames, filenames in os.walk(r"C:/Users/s/Desktop/filme/"): for subdirname in dirnames: foldere_filme = os.path.join(dirname, subdirname) numarul_folderelor = foldere_filme.replace("C:/Users/s/Desktop/filme/", "") wbk = xlwt.Workbook() sheet = wbk.add_sheet('sheet 1', cell_overwrite_ok=True) print numarul_folderelor #1,2,3,4,5... for filenames in os.listdir(foldere_filme): numele_pt_text = filenames.replace(".avi", "") print numele_pt_text for i in range(15): sheet.write(i,0,numele_pt_text) wbk.save("C:/Users/s/Desktop/text/"+numarul_folderelor+".xls")
My Information
- Member Title:
- New D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
Contact Information
- E-mail:
- Private
Friends
stergema hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
stergema has no profile comments yet. Why not say hello?