如何将字典转换为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 tourllib.urlencode()
.
原文:https://stackoverflow.com/questions/7801991
最满意答案
很确定我已经弄明白了,所以我会在这里发布这个过程供其他人看看:
第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:
(source: jamespwright.com)Step 2) Add a UILabel Control to your View:
(source: jamespwright.com)Step 3) Select "File's Owner":
(source: jamespwright.com)Step 4) Select the Identity Inspector (CMD + 4) and add a new Class Outlet:
(source: jamespwright.com)Step 5) Select the Connections Inspector (CMD + 2) and you should see your new Class Outlet there:
(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 ...
-
Monotouch定制UIView(Monotouch custom UIView)[2023-05-18]
我找到了一个有效的解决方案。 m_ActivityView = Activator.CreateInstance(); var view = NSBundle.MainBundle.LoadNib("ActivityUtilityView",m_ActivityView,null); m_ProgressView = Runtime.GetNSObject(views.ValueAt(0) as ActivityUtilityView; 在显示视图之前,使用Int ... -
对于你的上一个问题,我会回答“是”。 您仍然将接口连接到您的代码,但是目前您以编程方式动态执行此操作:通过或XML布局文件中的某些内容为视图提供id后然后在代码中调用,并在创建布局后, View myButton = findViewById(R.layout.myButton) 。 后者相当于IBOutlet并在IB中连接,除非在您需要时进行连接。 (如果需要,您也可以以编程方式为iPhone执行此操作。) IBAction的等价物 ...
-
如果你不使用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 ...
-
IBOutlets必须公开吗?(Do IBOutlets have to be public?)[2022-12-02]
你是对的,如果网点只与一个类的实现有关,那么它们不应该是“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 ...
-
Monotouch AVAssetReader(Monotouch AVAssetReader)[2022-03-13]
您需要像这样创建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 ...
-
IBOutlets循环(IBOutlets in a loop)[2022-10-14]
尝试使用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 ...