(새 문서: ==Python== 분류: Python * Python 2 <source lang='python'> mylist = [10,"test",10.5] print( type(mylist) ) print( mylist ) # <type 'list'> # [10, 'test', 10.5] mystr = str(mylis...) |
Jmnote bot (토론 | 기여) 잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight)) |
||
| (다른 사용자 한 명의 중간 판 7개는 보이지 않습니다) | |||
| 1번째 줄: | 1번째 줄: | ||
;list to string | |||
;array to string | |||
==PHP== | |||
[[분류: PHP]] | |||
{{참고|PHP print_r()}} | |||
{{참고|PHP var_export()}} | |||
<syntaxhighlight lang='php'> | |||
$arr = [10,"test",10.5]; | |||
$str = print_r( $arr, true ); | |||
echo gettype($str) . PHP_EOL; | |||
print_r( $str ); | |||
# string | |||
# Array | |||
# ( | |||
# [0] => 10 | |||
# [1] => test | |||
# [2] => 10.5 | |||
# ) | |||
</syntaxhighlight> | |||
<syntaxhighlight lang='php'> | |||
$arr = [10,"test",10.5]; | |||
$str = var_export( $arr, true ); | |||
echo gettype($str) . PHP_EOL; | |||
print_r( $str ); | |||
# string | |||
# array ( | |||
# 0 => 10, | |||
# 1 => 'test', | |||
# 2 => 10.5, | |||
# ) | |||
</syntaxhighlight> | |||
==Python== | ==Python== | ||
[[분류: Python]] | [[분류: Python]] | ||
* Python 2 | * Python 2 | ||
< | <syntaxhighlight lang='python'> | ||
mylist = [10,"test",10.5] | mylist = [10,"test",10.5] | ||
mystr = str(mylist) | mystr = str(mylist) | ||
print( type(mystr) ) | print( type(mystr) ) | ||
| 14번째 줄: | 42번째 줄: | ||
# <type 'str'> | # <type 'str'> | ||
# [10, 'test', 10.5] | # [10, 'test', 10.5] | ||
</ | </syntaxhighlight> | ||
[[분류: 형 변환]] | [[분류: 형 변환]] | ||
2020년 11월 2일 (월) 02:31 기준 최신판
- list to string
- array to string
1 PHP[ | ]
PHP
Copy
$arr = [10,"test",10.5];
$str = print_r( $arr, true );
echo gettype($str) . PHP_EOL;
print_r( $str );
# string
# Array
# (
# [0] => 10
# [1] => test
# [2] => 10.5
# )
PHP
Copy
$arr = [10,"test",10.5];
$str = var_export( $arr, true );
echo gettype($str) . PHP_EOL;
print_r( $str );
# string
# array (
# 0 => 10,
# 1 => 'test',
# 2 => 10.5,
# )
2 Python[ | ]
- Python 2
Python
Copy
mylist = [10,"test",10.5]
mystr = str(mylist)
print( type(mystr) )
print( mystr )
# <type 'str'>
# [10, 'test', 10.5]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.
- 분류 댓글:
- Python (25)
- PHP (8)
리눅스 Python 2.7 컴파일 설치 ― …리눅스 Python 2.7 컴파일 설치 ― …리눅스 Python 2.7 컴파일 설치 ― …리눅스 Python 2.7 컴파일 설치 ― …리눅스 Python 2.7 컴파일 설치 ― Jmnote리눅스 Python 2.7 컴파일 설치 ― ㅇㅇㅇ미운코딩새끼 ― 승호 도령미운코딩새끼 ― 불탄고등어미운코딩새끼 ― 김레이미운코딩새끼 ― 호박이미운코딩새끼 ― Junhg0211미운코딩새끼 ― 김왼손미운코딩새끼 ― 용딘이미운코딩새끼 ―Pinkcrimson
유기농냠냠파이썬 ― 호박유기농냠냠파이썬 ― 이에스유기농냠냠파이썬 ― 이승현파이썬 global ― Jmnote파이썬 global ― John Jeong파이썬 global ― Jmnote파이썬 global ― John Jeong파이썬 global ― John Jeong파이썬 global ― John Jeong파이썬 global ― Jmnote파이썬 global ― John Jeong