Skip to content
Advertisement

Tag: split

Output of split is not what I was expecting

I’m just learning python, and I’m having some problems reading a .txt file that I created. My objective: I have a txt file with a list of strings. I’m trying to read, process it and save every letter into a new list. example2.txt file: [one, two, THREE, one, two, ten, eight,cat, dog, bird, fish] [Alonso, Alicia, Bob, Lynn] , [red,

Different lines of input and output in Python

I’m currently trying to solve the max value problem. However, I’m now having a hard time getting many outputs at the same time. I try to use input().splitlines() to do it, but I only get one output. The test case and output need to have many lines just as the box’s examples. If anyone can provide me with some assistance,

Advanced string manipulation in Python

I’m trying to get only the value that are after the string 2021 from the following string: I need to get those 2 values separated (first one has to be 168088000000 and the second one has to be 61271000000 in this case). They have to be preceded by 2021 (and the result should give only the 2 numbers I mentioned

Pandas: Split and/or update columns, based on inconsistent data?

So I have a column that contains baseball team names, and I want to split it into the 2 new columns, that will contain separately city name and team name. Team New York Giants Atlanta Braves Chicago Cubs Chicago White Sox I would like to get something like this: Team City Franchise New York Giants New York Giants Atlanta Braves

Advertisement