本文介绍了x,= y(???)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我刚刚遇到了表格的分配 x,= y 其中y是一个字符串(如果它很重要)。 1.作业LHS中逗号的含义是什么? 2.如何我可以自己发现这个吗? (关于上面的(2),我查阅了几本Python 参考书的索引,但我不能找到(1)的答案。我希望 找到更好的Python参考!) TIA! kynn - 注意:在我的地址中,第一期之前的所有内容都是倒退的; 和最后一期,以及之后的所有内容都应该被丢弃。I just came across an assignment of the formx, = ywhere y is a string (in case it matters).1. What''s the meaning of the comma in the LHS of the assignment?2. How could I have found this out on my own?(Regarding (2) above, I consulted the index of several Pythonreference books but I could not find the answer to (1). I hope tofind a better Python reference!)TIA!kynn--NOTE: In my address everything before the first period is backwards;and the last period, and everything after it, should be discarded.推荐答案 这是打开一个1元组: (x,)= y 此处的括号不是必需的,有时会被遗漏。 - Erik Max Francis&& ma*@alcyone.com && http://www.alcyone.com/max/ 美国加利福尼亚州圣何塞市&& 37 18 N 121 57 W&& AIM,Y!M erikmaxfrancis 美国虽然希望在没有国家的情况下进行战争,但是没有国家会购买和平的b $ b。 - James MadisonIt''s unpacking a 1-tuple:(x,) = yThe parentheses here are not necessary and are sometimes left out.--Erik Max Francis && ma*@alcyone.com && http://www.alcyone.com/max/San Jose, CA, USA && 37 18 N 121 57 W && AIM, Y!M erikmaxfrancisThe United States, while they wish for war with no nation, will buypeace with none. -- James Madison 我仍然没有得到它。如果我们写了 y =''Y'' x,= y 有什么区别现在介于x和y之间?如果没有 的差异,那么执行此类解包的重点是什么? TIA! kynn - 注意:在我的地址中,第一期之前的所有内容都是倒退的; 和最后一位期间以及之后的所有内容都应该被丢弃。I still don''t get it. If we writey = ''Y''x, = ywhat''s the difference now between x and y? And if there''s nodifference, what''s the point of performing such "unpacking"?TIA!kynn--NOTE: In my address everything before the first period is backwards;and the last period, and everything after it, should be discarded. 尝试: y =" abc" x,= y 你正打开y(''Y' ',)Try:y = "abc"x, = yYou were unpacking y into (''Y'',) 这篇关于x,= y(???)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!