小编Sha*_*ter的帖子

“列表”对象没有属性“值”错误

我想将数据导入 Excel 工作表。问题是当我运行整个代码时,我收到一个错误,但是当我单独运行它时,它没有错误。

这是我想要的;

from xlwings import Workbook, Sheet, Range, Chart
import requests
import json

payload_city = {'cityId':3969, 'cmd':'districts'}
url = "https://www.garantimortgage.com/apps/Socket/Webservice.ashx"
r_city = requests.post(url, data=payload_city)


data_city = json.loads(r_city.text) #json to python data structure conversion
wb = Workbook()
dict = data_city[:] #translation in to dictionary
for i in list(range(len(dict))):
 print  data_city[i]["DistrictName"]
 payload_district = {'cityId':data_city[i]["CityId"], 'lbDistricts':data_city[i]["DistrictCode"], 'criter':149,'startdate':'2003-01','cmd':'result','areaCode':data_city[i]["AreaWideCode"]}

 r_district = requests.post(url, data=payload_district)

 data = json.loads(r_district.text)
 data = map(dict.values, data[u'output'][u'resultset'][u'record'][u'data']) #---->NOT OK.
 for row in data:
     Range("A1").value = zip(*data)
Run Code Online (Sandbox Code Playgroud)

但是当我运行它时;

from xlwings import …
Run Code Online (Sandbox Code Playgroud)

python excel vba

6
推荐指数
1
解决办法
4万
查看次数

带有Rails的Dropzonejs从页面中删除文件

我正在使用carrierwave和dropzonejs.一切似乎都很好,但当我尝试按下删除图片按钮时,即使它从数据库中删除,图片仍保留在容器上.

这是它的样子;

在此输入图像描述

当我点击删除所有文件链接时,它变成;

在此输入图像描述

所以我点击了所有删除文件按钮,它们将从数据库中删除,但保留在页面上.我认为这是因为下面的js代码(结束部分),

<script type="text/javascript">
$(document).ready(function(){
    // disable auto discover
    Dropzone.autoDiscover = false;

    // grap our upload form by its id
    $("#picture-dropzone").dropzone({
        // restrict image size to a maximum 5MB
        maxFilesize: 5,
        // changed the passed param to one accepted by
        // our rails app
        paramName: "picture[image]",

        acceptedFiles: "image/*", 
        // show remove links on each image upload
        addRemoveLinks: true,
        // if the upload was successful
        success: function(file, response){
            // find the remove button link of the uploaded file and …
Run Code Online (Sandbox Code Playgroud)

javascript ajax refresh ruby-on-rails image

5
推荐指数
1
解决办法
820
查看次数

标签 统计

ajax ×1

excel ×1

image ×1

javascript ×1

python ×1

refresh ×1

ruby-on-rails ×1

vba ×1