首页 \ 问答 \ 如何将字典转换为Python中的查询字符串?(How to convert a dictionary to query string in Python?)

如何将字典转换为Python中的查询字符串?(How to convert a dictionary to query string in Python?)

使用cgi.parse_qs() ,如何将结果(字典)转换回查询字符串? 寻找类似于urllib.urlencode()东西。


After using cgi.parse_qs(), how to convert the result (dictionary) back to query string? Looking for something similar to urllib.urlencode().


原文:https://stackoverflow.com/questions/7801991
更新时间:2023-07-20 07:07

最满意答案

很确定我已经弄明白了,所以我会在这里发布这个过程供其他人看看:

第1步)开始你的空视图像这样: 第1步http://www.jamespwright.com/images/public/screengrabs/7f2b8d35406e98ee5a00a81c6346e373.PNG

步骤2)将UILabel控件添加到您的视图中: 步骤2 http://www.jamespwright.com/images/public/screengrabs/d757c579238ffc27acabb69c55460071.PNG

第3步)选择“文件的所有者”: 第3步http://www.jamespwright.com/images/public/screengrabs/42900214063dbbc44cd4dbc2813d64eb.PNG

步骤4)选择Identity Inspector(CMD + 4)并添加一个新的Class Outlet: 步骤4 http://www.jamespwright.com/images/public/screengrabs/109318382a72ac9edad2bcd24e6a4b9f.PNG

步骤5)选择Connections Inspector(CMD + 2),你应该看到你的新的Class Outlet: 步骤5 http://www.jamespwright.com/images/public/screengrabs/2a2f9f4f0cc6680e7dd8c47cabba7e24.PNG

第6步)将连接拖到您的视图上的标签。

第7步)在你的代码中,你可以通过输入myLabel.Text = "My Label!"来填充它myLabel.Text = "My Label!"

希望这将在未来帮助别人。


Pretty sure that I've figured it out so I'll post the process here for others to look at:

Step 1) Start with your empty View like this: step 1
(source: jamespwright.com)

Step 2) Add a UILabel Control to your View: step 2
(source: jamespwright.com)

Step 3) Select "File's Owner": step 3
(source: jamespwright.com)

Step 4) Select the Identity Inspector (CMD + 4) and add a new Class Outlet: step 4
(source: jamespwright.com)

Step 5) Select the Connections Inspector (CMD + 2) and you should see your new Class Outlet there: step 5
(source: jamespwright.com)

Step 6) Drag the connection to your Label on your View.

Step 7) Inside your code you populate it by typing myLabel.Text = "My Label!"

Hopefully that will help someone else out in the future.

相关问答

更多
  • 很确定我已经弄明白了,所以我会在这里发布这个过程供其他人看看: 第1步)开始你的空视图像这样: 第1步http://www.jamespwright.com/images/public/screengrabs/7f2b8d35406e98ee5a00a81c6346e373.PNG 步骤2)将UILabel控件添加到您的视图中: 步骤2 http://www.jamespwright.com/images/public/screengrabs/d757c579238ffc27acabb69c55460071 ...
  • 我找到了一个有效的解决方案。 m_ActivityView = Activator.CreateInstance(); var view = NSBundle.MainBundle.LoadNib("ActivityUtilityView",m_ActivityView,null); m_ProgressView = Runtime.GetNSObject(views.ValueAt(0) as ActivityUtilityView; 在显示视图之前,使用Int ...
  • 对于你的上一个问题,我会回答“是”。 您仍然将接口连接到您的代码,但是目前您以编程方式动态执行此操作:通过
  • 如果你不使用setter / getter方法做任何事情,不要依赖关键值观察这些属性,也不要预期子类会从覆盖这些属性中受益,那么使用它就没有真正的缺点在ARC下的IBOutlets的ivars。 If you don't use the setter/getter methods for anything, don't rely on key-value observing for those properties, and don't anticipate that a subclass would be ...
  • 你是对的,如果网点只与一个类的实现有关,那么它们不应该是“public”(在.h文件中声明)。 您可以在.m文件内的类扩展中声明插座。 这些将被界面构建器识别。 在Xcode 4.3中,从模板创建的视图控制器子类为此自动添加了此类扩展。 使用助手编辑器将Ctrl拖入.m文件将创建新的出口。 You are right, if outlets are only relevant to the implementation of a class then they should not be "public" ...
  • 我最喜欢的API是System.Xml.Linq API,请查看文档和示例: http://msdn.microsoft.com/en-us/library/system.xml.linq.xdocument.aspx 对于你想要的,这很容易: var s = new XDocument () { new XElement ("root") }; Console.WriteLine ("The XML is: {0}", s.ToString ()); My favorite AP ...
  • 它应该是这个: MonoTouch.UIKit.UIVideo.SaveToPhotosAlbum public static void SaveToPhotosAlbum(string path,MonoTouch.UIKit.UIVideo.SaveStatus status) 来源: http : //docs.go-mono.com/MonoTouch.UIKit.UIVideo/Members It should be this one: MonoTouch.UIKit.UIVideo.SaveT ...
  • 您需要像这样创建NSDictionary: var videoSettings = NSDictionary.FromObjectAndKey ( new NSNumber ((int) MonoTouch.CoreVideo.CVPixelFormatType.CV32BGRA), MonoTouch.CoreVideo.CVPixelBuffer.PixelFormatTypeKey); SetNativeField完全不同(您将名为CVPixelBuffer.PixelFormatTypeK ...
  • 更新Xamarin.iOS Unified API Xamarin.iOS引入了统一API ,现在包含CGRect和CoreGraphics命名空间内的朋友。 CGRect映射到System.Drawing.RectangleF ( 请参阅类型映射 ) 所以如果你有自己的System.Drawing.RectangleF 代码看起来像 RectangleF visibleBounds = new RectangleF(0, 0, 10, 10); // Or your own instance of vis ...
  • 尝试使用Outlet Collection而不是Outlet 。 通过这种方式,您将拥有CustomTextField数组 例: @IBOutlet var textFields: [CustomTextField]! for field in self.textFields { } Try to use Outlet Collection instead of the Outlet. In this way you going to have array of the CustomTextField ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)