#coding =utf-8
Import OS
Os.chdir (' D:\\test2 ')
File_list=os.listdir ('. ')
Print "File_list:", file_list
Print "*" *100
For file in File_list:
Print Os.path.splitext (file) [0]
C:\python27\scripts>python task_test.py
File_list: [' 3rdParty access-requestform_team-apac-v2 edited by Tc.docx ', ' Carton status.xlsx ', ' Copy of IT Shifts o n Feb and Mar. 2.27-3.18.xlsx ', ' DB connection ', ' EXPORT ', ' export.xlsx ', ' export0131.xlsx ', ' Handle data format for SQL.D OCX ', ' handover ', ' Issue archivement.pst ', ' New Microsoft Excel worksheet.xlsx ', ' pkt status.xlsx ', ' Short_health Check gu Ide.docx ', ' Support note.xlsx ', ' Support note_bkp.xlsx ', ' Support summary.docx ', ' ~ $actice. docx ', ' ~ $ort _health Check Guide.docx ', ' ~ $pport summary.docx ', ' ~ $Support note.xlsx ', ' ~wrl0003.tmp ', ' ~wrl1399.tmp ', '?? Microsoft Office Word Document.docx ']
****************************************************************************************************
3rdParty Access-requestform_team-apac-v2 edited by TC
Carton status
Copy of IT Shifts on Feb and Mar. 2.27-3.18
DB Connection
EXPORT
Export
export0131
Handle data format for SQL
Handover
Issue archivement
New Microsoft Excel Worksheet
PKT Status
Short_health Check Guide
Support Note
Support NOTE_BKP
Support Summary
~ $actice
~ $ort _health Check Guide
~ $pport Summary
~ $Support Note
~wrl0003
~wrl1399
?? Microsoft Office Word Document
Python file operation exercise: Print all the filenames in a directory, do not include the suffix name