I have an URL in Mechanize in Python that reads:
members_booking.php?operation=member_day&course_id=1&d_date=2011-10-5&comp=1
But I want to change that url depending on the data that the user inputs to the console, eg:
year = raw_input("Enter the YEAR")
month = raw_input("Enter the MONTH")
day = raw_input("Enter the DAY")
And so that depending on the data the user has inputted in the above code, it will change the url. (where it says d_date=2011-10-5& in the url, I basically want to change it to d_date=year-month-dat&
How do I edit these strings based on the users input? In C (my only point of reference) I would use "d_date=%i-%i-%i&", year, month, day or something to that effect
urlstring = "members_booking.php?operation=member_day&course_id=1&d_date=%s-%s-%s&comp=1"
year = raw_input("Enter the YEAR: ")
month = raw_input("Enter the MONTH: ")
day = raw_input("Enter the DAY: ")
print urlstring % (year, month, day)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.