cancel
Showing results for 
Search instead for 
Did you mean: 

appending values horizontally to a list

SOLVED
Occasional Contributor

appending values horizontally to a list

is there is a way to horizontally add items to a list.Normally it is added vertically.

1 ACCEPTED SOLUTION

Accepted Solutions
Occasional Contributor

Re: appending values horizontally to a list

@TanyaGorbunova 

It was just a for loop.My requirement was to take out 4 values each from a list of 600+ values horizontally.I think I messed up  the question I asked here.Please find the code below.

for m in range(0, (len(valueList)-1), 4):
regexpattern=(".*")+re.escape(valueList[m])+(".*")+(valueList[m+1])+(".*")+re.escape(valueList[m+2])+(".*")+re.escape(valueList[m+3])+(".*")

 

 

6 REPLIES 6
Community Hero

Re: appending values horizontally to a list

I'm not sure I understand the question.  What kind of list? What do you mean "horizontally" versus "vertically"? 


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Occasional Contributor

Re: appending values horizontally to a list

Dear Robert,

I have created a set of values from a json file in a list which have around 700+ values.I wanted to rearrrange it to columns of 4.Could you please guide me for the same.

Thank you.

 

Community Hero

Re: appending values horizontally to a list

Are you inputting these values into columns in some table or something? Because, in "abstract" code, there really isn't much the idea of rows and columns.  Of course, I could be missing something here but I'm still not sure I understand your goal.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Occasional Contributor

Re: appending values horizontally to a list

My problem is resolved.Thanks for the reply.

Community Manager

Re: appending values horizontally to a list

Great to hear this, @manuelaneena,

 

Please share your solution with us.

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Occasional Contributor

Re: appending values horizontally to a list

@TanyaGorbunova 

It was just a for loop.My requirement was to take out 4 values each from a list of 600+ values horizontally.I think I messed up  the question I asked here.Please find the code below.

for m in range(0, (len(valueList)-1), 4):
regexpattern=(".*")+re.escape(valueList[m])+(".*")+(valueList[m+1])+(".*")+re.escape(valueList[m+2])+(".*")+re.escape(valueList[m+3])+(".*")

 

 

New Here?
Join us and watch the welcome video:
Watch the New Interview
APITestingMistake#2
Top Kudoed Authors