Go Back   SEQanswers > General

Similar Threads
Thread Thread Starter Forum Replies Last Post
Open and read files in python deKoch13 Bioinformatics 1 03-25-2019 08:20 AM
rename mutiple fasta header for mutiple fasta files shashankgupta Bioinformatics 2 02-15-2017 06:55 PM
Help with sorting sam files in python! mavadhani General 6 12-08-2016 10:14 AM
Handling Ties To Get Top N elements in a list in python AnushaC Bioinformatics 0 11-07-2015 05:32 PM
Python API for VCF files mspivakov Bioinformatics 7 04-08-2014 03:51 AM

Thread Tools
Old 03-18-2019, 07:52 AM   #1
Location: HD

Join Date: Mar 2019
Posts: 12
Default Rename files that are stored in a list in python


I generated a list that contains 3 text files

list = [path/A.txt, path/B.txt, path/C.txt]

Now, I want to remove the paths of the filenames, so that I have:

list = [A.txt, B.txt, C.txt]

I tried to use the os.path.basename() function in a for loop:

for file in list:
file = os.path.basename(file)

I know this does not work out and I have to adress the indices of the files in the list somehow, but I got stuck...

Can someone help me with this issue?


Last edited by deKoch13; 03-18-2019 at 08:00 AM.
deKoch13 is offline   Reply With Quote

basename, file handling, lists, python

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -8. The time now is 04:47 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO