본문 바로가기
반응형

Computer Languages27

Python에서 JSON 데이터 예시보기 개인공부용이라 간단히올려요 :) JSON 정의 () 인터넷에서 자료를 주고받을 때 그 자료를 표현하는 방법이다. 자료의 종류에 큰 제한은 없으며, 특히 컴퓨터 프로그램의 변수값을 표현하는 데 적합하다. 그 형식은 자바스크립트의 구문 형식을 따르지만, 프로그래밍 언어나 플랫폼에 독립적이므로 C, C++, C#, 자바, 자바스크립트, 펄, 파이썬 등 많은 언어에서 이용할 수 있다. Python에서의 JSON 예제 #data, data2, data3 비교형식으로 작성함 >>> import json >>> data = {1:'a',2:'b'} >>> data2 = json.dumps(data) >>> data3 = json.loads(data2) >>> type(data) >>> type(data2) >>> t.. 2013. 1. 23.
urllib.urlencode ======================================개인 공부용도로 적었습니다. (나중에 까먹을까봐서 ㅋ_ㅋ)====================================== >>> import urllib >>> data = {'x':'a'} >>> data = urllib.urlencode(data) >>> print data x=a data값 {'x':'a'}가 urllib.urlencode(data)공장을 지나서 x=a로 바뀌었다!! 2013. 1. 22.
string::getline string의 getline함수는 cin으로 입력받을때 공백도 같이 입력받을수 있다. [예제] // string_getline_sample.cpp // compile with: /EHsc // Illustrates how to use the getline function to read a // line of text from the keyboard. // // Functions: // // getline Returns a string from the input stream. ////////////////////////////////////////////////////////////////////// #pragma warning(disable:4786) #include #include using names.. 2010. 11. 19.
string을 char로 취급하기 #include #include using namespace std; int main() { string name; cin >> name; cout 2010. 10. 21.
728x90