我在Windows 10上安装了Android Studio最新版本.(我已经用另一个版本和另一个Windows 10做了)它可以用android SDK但是当它想要加载一个项目时它说:
错误:(23,17)无法解决:junit:junit:4.12
这是日志:
JsonSyntaxException:在读取distributions时解析异常.json:java.lang.IllegalStateException:预期为BEGIN_ARRAY但在第1行第1行为STRING路径$
gradle.build文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.mohammad.myapplication"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
}
Run Code Online (Sandbox Code Playgroud) 我有一个名为两个表users,并permissions和我想创建一个使用指定表它们之间的关系userPermissions。这是我的代码的样子:
类User(Base):
__tablename__ ='用户'
id =列(整数,primary_key = True)
first_name =列(文本)
last_name = Column(文本,nullable = True)
类Permission(Base):
__tablename__ ='权限'
id =列(整数,primary_key = True)
标题=列(String(64))
allow_anonymous =列(布尔)
类UserPermission(Base):
__table__ ='userPermissions'
id =列(整数,primary_key = True)
user_id =列(整数,ForeignKey('users.id'))
Permission_id = Column(整数,ForeignKey('permissions.id'))
值=列(布尔)
我知道我可能做错了人际关系,但是通过文档和搜索进行搜索,我找不到它是什么。当我尝试使用db.Base.metadata.create_all(db.engine)它创建表时,出现以下错误:
/usr/bin/python3.6 /path/project/out.py
Traceback (most recent call last):
File "/path/project/out.py", line 1, in <module>
from components.database import setup
File "/path/project/components/database/__init__.py", line 41, in <module>
class UserPermission(Base):
File "/home/user/.local/lib/python3.6/site-packages/sqlalchemy/ext/declarative/api.py", line 65, in __init__
_as_declarative(cls, classname, …Run Code Online (Sandbox Code Playgroud) 首先,代码获取一个名称并生成一个具有w权限的文件(也经过测试 r+),它应该在文件中写入任何其他输入,但事实并非如此.我得到一个空文件.
user_name_in =input("gets Input")
fname = user_name_in
f = input()
ufile = open(fname,"w")
while True:
f=input(answer)
ufile.write(f)
Run Code Online (Sandbox Code Playgroud) 我有这样的字典:
d = {'first':'', 'second':'', 'third':'value', 'fourth':''}
Run Code Online (Sandbox Code Playgroud)
我想找到第一个非空值(在这个例子中是它的名字'third').可能有多个非空值,但我只想要找到第一个非空值.
我怎样才能做到这一点?