0

Is there a way to split a string into variables using multiple space as a separator? I am using following lines in my script but seems it is not working.

pathway_class, pathway_subclass = value.split(' ', 1)
pathway_class, pathway_subclass = value.split('\s+', 1)

The value column looks like this:

      map00010                    Pathway

      map00020                    Pathway

      map00030                    Pathway

      map00040                    Pathway

      map00051                    Pathway

I would like to only fetch the 'map' ids (map00010 and so on).

Any help is highly appreciated.

petezurich
  • 9,280
  • 9
  • 43
  • 57
rshar
  • 1,381
  • 10
  • 28

1 Answers1

0
value='map00010                    Pathway'
pathway_class, pathway_subclass=value.split()
print(pathway_class)
print(pathway_subclass)

this results in

map00010
Pathway
sharath k
  • 56
  • 2