【发布时间】:2011-12-08 03:09:47
【问题描述】:
我在 Python 中的 Mechanize 中有一个 URL,内容如下:
members_booking.php?operation=member_day&course_id=1&d_date=2011-10-5&comp=1
但我想根据用户输入到控制台的数据更改该网址,例如:
year = raw_input("Enter the YEAR")
month = raw_input("Enter the MONTH")
day = raw_input("Enter the DAY")
因此,根据用户在上述代码中输入的数据,它会改变 url。 (它在网址中说 d_date=2011-10-5& ,我基本上想将其更改为 d_date=year-month-dat&
如何根据用户输入来编辑这些字符串?在 C 语言中(我唯一的参考点)我会使用“d_date=%i-%i-%i&”、年、月、日或类似的东西
【问题讨论】:
标签: python string parsing printing mechanize