Home > other >  String should fill out a form with what method, please?
String should fill out a form with what method, please?

Time:02-01

A set of strings that contain web form id and data, such as "id1: male; Id2: the han nationality; Id3: city of zhengzhou in henan province;" This string, split it, and then fill in the corresponding data corresponding id box on the page, what method should use it?

CodePudding user response:

 idDict={} 
IdData="HTTP://https://bbs.csdn.net/topics/id1: male; Id2: the han nationality; Id3: city of zhengzhou in henan province;"
SpIdData="https://bbs.csdn.net/topics/:". The join (idData. Split ('; ')). The split (' : ')

For I in range (len (spIdData)//2) :
IdDict [spIdData [2 * I]]=spIdData [* 2 + 1] I

Print (idDict [' id3 '])
try to turn the dictionary

CodePudding user response:

The split method
  • Related