Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (1.6k points)

I am trying to urlencode this string before I submit.

queryString = 'eventName=' + evt.fields["eventName"] + '&' + 'eventDescription=' + evt.fields["eventDescription"]; 

1 Answer

0 votes
by (25.1k points)

Just create a dictionary with your parameters to be encoded in the urlencode function of urrlib module. e.g:

For python 2: 

import urllib

d = {'a': 'b', 'c': 'd'};

urllib.urlencode(d)

For Python 3

import urllib

d = {'a': 'b', 'c': 'd'};

urllib.parse.urlencode(d)

Related questions

0 votes
1 answer
asked Oct 15, 2019 in Python by Sammy (47.6k points)

Browse Categories

...