Skip to content Skip to footer

pycharm 换行_pycharm回车不能换行

大家好,又见面了,我是你们的朋友全栈君。

python脚本有时一行代码写的非常长,一个屏幕塞不下,左右拉动滚动条视觉不友好。

第一种方法:python里有换行标识”\”,如

代码语言:javascript复制jfdb=spark.read.format("jdbc").option("driver", mysql_driver).option("url", mysql_url).option("dbtable", "xxxxxxxxxxxxxxxxxxxxxxxx").option("user", mysql_acount).option("password", mysql_password).load().where("bank='1234' ").select("col1").rdd.collect()[0]['col1']太长,我们可以写成如下形式

代码语言:javascript复制jfdb=spark.read.format("jdbc").option("driver", mysql_driver).option("url", mysql_url)\

.option("dbtable", "tableName").option("user", mysql_acount).option("password", mysql_password).load()\

.where("bank='1234' ").select("col1").rdd.collect()[0]['col1']第二种方法设置pycharm自动换行。

点击file -> settings -> Editor -> General -> Soft Wraps

勾选

可以选择自动换行的文件类型。

最后效果如图

自动换行的地方有个回转的小箭头,代表跟上一行其实是属于同一行。这样就不需要拉滚动条看全部的代码了。

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/174876.html原文链接:https://javaforall.cn

Copyright © 2088 手游限时活动通 - 周末狂欢福利 All Rights Reserved.
友情链接