This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//一、基类和派生类具有相同成员时 | |
//第7章中已经说明了一旦继承之后,派生类就具有了基类的公有成员和保护成员,可以直接使用,在外部也可直接访问基类的公有成//员。这一章//要讲解的是如果基类和派生类具有相同名称的成员变量或可以成员函数时,如何区别使用。 | |
//下面例子中,基类和派生类都有成员变量“id”和成员函数“show()”,无论是在派生类的内部还是外部,直接调用的成员都是派生类//的成员,//而基类的成员函数show()未被调用。要调用基类成员,必须在成员函数名前加上范围(类名::),这也适用于基类的成员//变量。 | |
#include <iostream> | |
#include <string> | |
using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#define CCOUNT 7 | |
#define false 0 | |
#define true 1 | |
//typedef char bool; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
absolutely_unused_variable = os.system('cls' if os.name=='nt' else 'clear') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
/* | |
* two ways of converting float to string or char | |
* | |
* */ | |
typedef union { | |
float f; | |
char c[4]; | |
} my_union_t; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, sys, inspect | |
# realpath() will make your script run, even if you symlink it :) | |
cmd_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0])) | |
if cmd_folder not in sys.path: | |
sys.path.insert(0, cmd_folder) | |
# use this if you want to include modules from a subfolder | |
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"subfolder"))) | |
if cmd_subfolder not in sys.path: | |
sys.path.insert(0, cmd_subfolder) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from PyQt5.QtWidgets import (QWidget, QDataWidgetMapper, | |
QLineEdit, QApplication, QGridLayout, QListView) | |
from PyQt5.QtCore import Qt, QAbstractTableModel, QModelIndex | |
class Window(QWidget): | |
def __init__(self, parent=None): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, bs4, os | |
from lxml import html | |
page_num = 5 | |
username = '[email protected]' | |
password = 'AAABBBCCC' | |
headers = { | |
'User-Agent': 'Mozilla/5.0 (Macintosh; ' | |
'Intel Mac OS X 10_11_2) ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
longqi 20/Jan/16 22:42 | |
""" | |
""" | |
default.txt | |
""" | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
longqi 21/Jan/16 14:35 | |
""" | |
# This is only needed for Python v2 but is harmless for Python v3. | |
import sip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
longqi 21/Jan/16 15:36 | |
"""#!/usr/bin/env python2 | |
# -*- coding: utf-8 -*- | |
import sys | |
from datetime import date |
OlderNewer