简体   繁体   中英

How to extract number from a list of string to be in a new column with python?

I have this file name as follows:

8550 - Field Data Progress_070720.xlsx

and I need to get the 8550 only to be in a new column.

How can I do this with python?

Thankyou

As I can get the string from my filename, so I need to:

filename = os.path.basename(xls)

then from the filename , I want to extract 8550 only to appear in a new column.

I was thinking to use split.str , but I did not get the exact script to extract only

Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM