我尝试了很多方法,但似乎都没有.帮助我使用python与linkedin建立连接.我有所有的代币.我有python 2.7.5.请发布建立连接的基本代码示例并获取用户名.
下面,我已经完成了角色的角色,例如示例,但它不起作用.
https://github.com/ozgur/python-linkedin <---这是我得到api的地方,我完全复制了它.见下文:
CONSUMER_KEY = '9puxXXXXXXXX' # This is api_key
CONSUMER_SECRET = 'brtXoXEXXXXXXXX' # This is secret_key
USER_TOKEN = '27138ae8-XXXXXXXXXXXXXXXXXXXXXXXXXXX' # This is oauth_token
USER_SECRET = 'ca103e23XXXXXXXXXXXXXXXXXXXXXXXXXXX' # This is oauth_secret
from linkedin import linkedin
# Define CONSUMER_KEY, CONSUMER_SECRET,
# USER_TOKEN, and USER_SECRET from the credentials
# provided in your LinkedIn application
# Instantiate the developer authentication class
authentication = linkedin.LinkedInDeveloperAuthentication(CONSUMER_KEY, CONSUMER_SECRET,
USER_TOKEN, USER_SECRET,
RETURN_URL, linkedin.PERMISSIONS.enums.values())
# Pass it in to the app...
application = linkedin.LinkedInApplication(authentication)
# Use …Run Code Online (Sandbox Code Playgroud) 我在我的程序中使用time.sleep(10).我运行程序时可以在shell中显示倒计时吗?
>>>run_my_program()
tasks done, now sleeping for 10 seconds
Run Code Online (Sandbox Code Playgroud)
然后我想要它做10,9,8,7 ....
这可能吗?
我有2个阵列.
a1 = [1,2,4]
a2 = [3,4,5]
Run Code Online (Sandbox Code Playgroud)
我如何使用python找到这两个数组之间的相关性.
在matlab中,你会这样做:
corr(a1,a2)
Run Code Online (Sandbox Code Playgroud)
如何在python中执行此操作?
给定目标金额和硬币面额列表,我的代码应该找到达到目标金额所需的最少硬币.
例子:
C(78, [1, 5, 10, 25, 50]) = 6
C(48, [1, 7, 24, 42]) = 2
C(35, [1, 3, 16, 30, 50]) = 3
我使用for循环创建了代码,但是如何使其递归?
def C(i, coins, cdict = None):
if cdict == None:
cdict = {}
if i <= 0:
cdict[i] = 0
return cdict[i]
elif i in cdict:
return cdict[i]
elif i in coins:
cdict[i] = 1 …Run Code Online (Sandbox Code Playgroud) 我在matlab中有一个函数:
function output = myfunc(a,b,c,d,e)
%a and b are mandetory
%c d and e are optional
end
Run Code Online (Sandbox Code Playgroud)
如果用户为 e 提供了可选参数但没有为 c 和 d 提供了可选参数,我将如何处理输入?
nargin 只是给出参数的数量。存在是最好的方式吗?
我想用python的乌龟编写一个程序来创建一个带有关卡的树.下面是一些I/O,所以你看看它是做什么的.

我的程序适用于第一种情况,但对于第二种情况打印太多.该计划的规定如下:
必须是递归的
只能使用以下龟功能:
turtle.forward(100) <-- turtle goes forward 100 steps
turtle.right(90) <-- turtle turns right 90 degrees
turtle.penup() <-- turtle lifts its pen up off of the paper
turtle.forward(100) <-- turtle goes forward 100 steps
turtle.pendown() <-- turtle puts its pen down on the paper
turtle.pencolor("red") <-- turtle uses red pen
turtle.circle(100) <-- turtle draws circle of radius 100
turtle.pencolor("blue") <-- turtle changes to blue pen (most other common colors work too!)
turtle.forward(50) <-- turtle moves forward 50 steps …Run Code Online (Sandbox Code Playgroud)我试图学习游程长度编码,但是我在网上发现了我做不到的挑战。它要求您编写一个称为compression(strg)的压缩函数,该函数将长度为64的二进制字符串strg作为输入,并返回另一个二进制字符串作为输出。输出二进制字符串应为输入字符串的游程长度编码。
压缩('1010101001010101101010100101010110101010010101011010101001010101')
'1010101001010101 * 4'
这是我所拥有的,但是找不到该模式:
from itertools import *
def compression(strg):
return [(len(list(group)),name) for name, group in groupby(strg)]
Run Code Online (Sandbox Code Playgroud)
我需要一些帮助来解决这个问题。
使用任何针对Python的Facebook API,我试图让那些分享我的帖子的人和那些人是谁.我目前有第一部分..
>>> from facepy import *
>>> graph = GraphAPI("CAAEr")
>>> g = graph.get('apple/posts?limit=20')
>>> g['data'][10]['shares']
Run Code Online (Sandbox Code Playgroud)
这是重要的,但我想知道那些人是谁.
我有两个不相关的问题.
这就是我目前用facebook api获取朋友的数量:
>>> from facebook import *
>>> token = 'whatevertheinfo'
>>> graph = facebook.GraphAPI(token)
>>> friends = graph.get_connections("me", "friends")
>>> len(friends['data'])
1
Run Code Online (Sandbox Code Playgroud)
如果我尝试>>> friends = graph.get_connections("100000549223625", "friends")我收到此错误:
Traceback (most recent call last):
File "<pyshell#55>", line 1, in <module>
friends = graph.get_connections("100000549223625", "friends")
File "C:\Documents and Settings\visolank\Desktop\Python\programs\facebook.py", line 112, in get_connections
return self.request(id + "/" + connection_name, args)
File "C:\Documents and Settings\visolank\Desktop\Python\programs\facebook.py", line 298, in request
raise GraphAPIError(response)
GraphAPIError: Unsupported operation
Run Code Online (Sandbox Code Playgroud)
我不需要知道朋友是谁,我只需要一个号码.我知道这是可能的,因为facebook声称:
"公开资料和朋友列表
公共个人资料和好友列表是应用可用的基本信息.必须明确要求所有其他权限和内容."
我只是想使用vba向我的图表添加图表标题。我实际上想对每个工作表中的每个图表进行递归操作,但是我什至无法获得一张图表。这是我的代码:
Dim chnam
chnam = Left(ActiveSheet.Name, (Len(ActiveSheet.Name) - 9))
With ActiveWorkbook.ActiveSheet.ActiveChart
.HasTitle = True
.ChartTitle = chnam
End With
Run Code Online (Sandbox Code Playgroud)
这是我的图表:

运行代码时,我得到:
Object does not support this property or method
Run Code Online (Sandbox Code Playgroud)