Erinevus lehekülje "JavaPython:String" redaktsioonide vahel
Mine navigeerimisribale
Mine otsikasti
1. rida: | 1. rida: | ||
{{JavaPython-sisukord}} | {{JavaPython-sisukord}} | ||
+ | |||
+ | In python, string can reside in a pair of single quotes as well as a pair of double quotes. It supports multiplication: "x"*3 is "xxx". | ||
== Näide == | == Näide == |
Redaktsioon: 2. veebruar 2016, kell 10:48
Java vs Python |
|
In python, string can reside in a pair of single quotes as well as a pair of double quotes. It supports multiplication: "x"*3 is "xxx".
Näide
Java | Python |
---|---|
<syntaxhighlight lang="java" line="1" >
//string String city = "New York"; String state = "California";//has to be " not ' String lines = "multi-line " + "string"; </syntaxhighlight> |
<syntaxhighlight lang="python" line="2" >
city = "New York" state = 'California'
lines = """multi-line string""" moreLines = multi-line string </syntaxhighlight> |